home *** CD-ROM | disk | FTP | other *** search
- /*
- * The original copyright owners of the accompanying source code files have
- * agreed to place such code into the public domain. Accordingly, anyone
- * who receives or obtains a copy of such source code is freely entitled to
- * reproduce, use and otherwise exploit such code (including the right to
- * make derivative works), at his/her own risk and expense, without any
- * obligation or liability to the original copyright owners.
- *
- * We would appreciate (but do not require) that the following message be
- * included in any derivative works:
- *
- * "Portions of this program were developed by Peter Broadwell, Rob Myers
- * and Robin Schaufler while working in Silicon Valley."
- *
- * The accompanying source code files and related documentation materials
- * are distributed on an "AS IS" basis, without any warranties or
- * guarantees of any kind. All implied warranties, including the implied
- * warranties of merchantability and of fitness for any particular purpose,
- * are expressly disclaimed.
- */
- #include "gl.h"
- #include "geom.h"
- #include "selectors.h"
- #include "class.h"
- #include "classIds.h"
- #include "mbox.h"
- #include "individual.h"
- #include "behavior.h"
- #include "doers.h"
-
- #include "colors.h"
-
- extern class indivClass;
- model guppyBody, guppyTail;
-
- extern char *changeSpeed(), *changeHead(), *changeAzimuth();
-
- fcnTable guppyTable[] = {
- NEWSPEED, changeSpeed,
- NEWHEADING, changeHead,
- NEWAZIMUTH, changeAzimuth,
- EOTABLE,
- };
-
- class guppyClass = {
- &indivClass,
- guppyTable,
- sizeof(individual),
- GUPPY,
- };
-
- individual guppyTemplate = {
- /* inst */
- &guppyClass, /* myClass pointer */
- NULL, /* classFunctions */
- 0, /* nFunctions */
- /* mailbox */
- NULL, /* subscribers */
- NULL, /* subscribedTo */
- /* individual */
- {0,0,0}, /* position */
- {0,0,0}, /* lastPosition */
- {1,0,0}, /* delta */
- {1,1,1}, /* velocity */
- {1,1,1}, /* avelocity */
- {3,4,0}, /* acceleration */
- 30.0, /* speed */
- {40,50,10}, /* heading */
- {0,0,0}, /* rotation */
- {0,0,0}, /* influence */
- 1.0, /* scale */
- &guppyBody, /* model */
- ORDER, /* flags */
- NULL, /* curVars */
- };
-
- point guppyBodyPoints[] = {
- { 0, 0, 0, }, /* gratuitous vertex 0 */
- { 600, 000, 000, },
- { 000, -100, 000, },
- { 000, 100, 000, },
- { 150, 000, -320, },
- { 590, 000, -150, },
- { 510, 000, -250, },
- { 300, 000, -320, },
- };
-
- point guppyEyePoints[] = {
- { 0, 0, 0, }, /* gratuitous vertex 0 */
- { -10, 000, 0, },
- { 10, 000, 30, },
- { 10, 000, 60, },
- { -10, 000, 80, },
- { -30, 000, 100, },
- { -70, 000, 100, },
- { -80, 000, 90, },
- { -100, 000, 60, },
- { -100, 000, 30, },
- { -90, 000, 0, },
- { -40, 000, -10, },
- };
-
- point guppyIrisPoints[] = {
- { 0, 0, 0, }, /* gratuitous vertex 0 */
- { -10, 000, 0, },
- { 10, 000, 30, },
- { 10, 000, 60, },
- { -10, 000, 80, },
- { -40, 000, 90, },
- { -70, 000, 70, },
- { -80, 000, 40, },
- { -70, 000, 10, },
- { -40, 000, 0, },
- };
-
- point guppyTailPoints[] = {
- { 0, 0, 0, }, /* gratuitous vertex 0 */
- { 0, 000, 0, },
- { -300, 000, 600, },
- { -300, 000, -300, },
- };
- /* null terminated polys, double null at end */
- long guppyBodyVertices[] = {
- 1,5,6,7,4,2,0,
- 1,3,4,7,6,5,0,
- 1,2,3,0,
- 2,4,3,0,
- 0,
- };
- long guppyLEyeVertices[] = {
- 1,2,3,4,5,6,7,8,9,10,11,0,
- 0,
- };
- long guppyLIrisVertices[] = {
- 1,2,3,4,5,6,7,8,9,0,
- 0,
- };
- long guppyREyeVertices[] = {
- 11,10,9,8,7,6,5,4,3,2,1,0,
- 0,
- };
- long guppyRIrisVertices[] = {
- 9,8,7,6,5,4,3,2,1,0,
- 0,
- };
- long guppyTailVertices[] = {
- 1,2,3,0,
- 1,3,2,0,
- 0,
- };
-
- model guppyTail = {
- NULL, /* next model segment */
- NULL, /* child model segments */
- 0, /* geometry compiled yet? */
- 0, /* compiled geometry object Id */
- guppyTailPoints, /* point dictionary */
- guppyTailVertices, /* polygon descriptions */
- { -100,0,-100}, /* centroid */
- GUPPYTAIL_COLOR, /* color */
- GUPPYTAIL_TEXTURE, /* texture */
- TRUE, /* outlined */
- { 0,0,0}, /* rotation */
- { 100,0,-200}, /* translation */
- { 1.0,1.0,1.0}, /* scale */
- 5, /* declasse */
- };
-
- model guppyLIris = {
- NULL, /* next model segment */
- NULL, /* child model segments */
- 0, /* geometry compiled yet? */
- 0, /* compiled geometry object Id */
- guppyIrisPoints, /* point dictionary */
- guppyLIrisVertices, /* polygon descriptions */
- { -40,0,45}, /* centroid */
- GUPPYIRIS_COLOR, /* color */
- GUPPYIRIS_TEXTURE, /* texture */
- FALSE, /* outlined */
- { 0,0,0}, /* rotation */
- { 0,0,0}, /* translation */
- { 1.0,1.0,1.0}, /* scale */
- 25, /* declasse */
- };
- model guppyLEye = {
- NULL, /* next model segment */
- &guppyLIris, /* child model segments */
- 0, /* geometry compiled yet? */
- 0, /* compiled geometry object Id */
- guppyEyePoints, /* point dictionary */
- guppyLEyeVertices, /* polygon descriptions */
- { -45,0,45}, /* centroid */
- GUPPYEYE_COLOR, /* color */
- GUPPYEYE_TEXTURE, /* texture */
- FALSE, /* outlined */
- { 0,0,0}, /* rotation */
- { 500,-25,-120}, /* translation */
- { 1.0,1.0,1.0}, /* scale */
- 30, /* declasse */
- };
- model guppyRIris = {
- NULL, /* next model segment */
- NULL, /* child model segments */
- 0, /* geometry compiled yet? */
- 0, /* compiled geometry object Id */
- guppyIrisPoints, /* point dictionary */
- guppyRIrisVertices, /* polygon descriptions */
- { -40,0,45}, /* centroid */
- GUPPYIRIS_COLOR, /* color */
- GUPPYIRIS_TEXTURE, /* texture */
- FALSE, /* outlined */
- { 0,0,0}, /* rotation */
- { 0,0,0}, /* translation */
- { 1.0,1.0,1.0}, /* scale */
- 25, /* declasse */
- };
- model guppyREye = {
- &guppyLEye, /* next model segment */
- &guppyRIris, /* child model segments */
- 0, /* geometry compiled yet? */
- 0, /* compiled geometry object Id */
- guppyEyePoints, /* point dictionary */
- guppyREyeVertices, /* polygon descriptions */
- { -45,0,45}, /* centroid */
- GUPPYEYE_COLOR, /* color */
- GUPPYEYE_TEXTURE, /* texture */
- FALSE, /* outlined */
- { 0,0,0}, /* rotation */
- { 500,25,-120}, /* translation */
- { 1.0,1.0,1.0}, /* scale */
- 30, /* declasse */
- };
- model guppyBody = {
- &guppyTail, /* next model segment */
- &guppyREye, /* child model segments */
- 0, /* geometry compiled yet? */
- 0, /* compiled geometry object Id */
- guppyBodyPoints, /* point dictionary */
- guppyBodyVertices, /* polygon descriptions */
- { 300,0,-200}, /* centroid */
- GUPPYBODY_COLOR, /* color */
- GUPPYBODY_TEXTURE, /* texture */
- TRUE, /* outlined */
- { 0,0,0}, /* rotation */
- { 0,0,0}, /* translation */
- { 1.0,1.0,1.0}, /* scale */
- 0, /* declasse */
- };
-